﻿@model Cafeteria.Models.Administracion.Sucursal.SucursalBean

@{
    ViewBag.Title = "Añadir productos";
}

<h2>@ViewBag.Title</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

    
  @using (Html.BeginForm("añadirproductos", "Sucursal", FormMethod.Post, new { @class = "form", id = "validate" }))
  {
    
    <fieldset>
        <div class="widget">
            <div class="title">
                <h6>Sucursal</h6>
            </div>
            <div class="formRow"> @Html.LabelFor(model => model.nombre)
                <div class=" formRight">  @Html.DisplayFor(model => model.nombre)  </div>@Html.HiddenFor(model => model.id) 
                <div class="clear"></div>
            </div>
            <div class="formRow"> @Html.LabelFor(model => model.ruc)
                <div class=" formRight">  @Html.DisplayFor(model => model.ruc)  </div>@Html.HiddenFor(model => model.ruc) 
                <div class="clear"></div>
            </div>
            <div class="formRow"> @Html.LabelFor(model => model.direccion)
                <div class=" formRight">  @Html.DisplayFor(model => model.direccion)  </div>@Html.HiddenFor(model => model.direccion) 
                <div class="clear"></div>
            </div>
            
             @for (int i = 0; i < Model.listaProductos.Count; i++)
             {
                    @Html.HiddenFor(model => model.listaProductos[i].id)  
             }
        </div>
    </fieldset>
      
      <div class="wrapper">
    <div class="widget">
      <div class="title">
      <h6>Lista de Productos</h6>
      </div>
      
      <div class="dataTables_wrapper">
            
            <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable">
    <thead>
        <tr>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                ID
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Nombre
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Cantidad
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
             <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Precio venta
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>

        </tr>
    </thead>

    <tbody>
             @for (int i = 0; i < Model.listaProductos.Count; i++)
             {
                 if (!Model.listaProductos[i].estadodispo)
                 {  
                    <tr class="gradeA odd">       
                
                        <td class="formRow"> @Html.DisplayFor(model => model.listaProductos[i].id) </td>
                        <td class="formRow"> @Html.DisplayFor(model => model.listaProductos[i].nombre) </td>
                        <td class="formRow"> 
                            @Html.TextBoxFor(model => model.listaProductos[i].cantidad, new { maxlength = "3", placeholder = "Solo números" })
                        </td>
                        <td class="formRow"> 
                            @Html.TextBoxFor(model => model.listaProductos[i].precioventa2)
                        </td>
                    </tr>
                 }
                 else
                 {
                     @Html.HiddenFor(model => model.listaProductos[i].nombre) 
                     @Html.HiddenFor(model => model.listaProductos[i].cantidad)         
                     @Html.HiddenFor(model => model.listaProductos[i].precioventa2)
                 }
             }
    </tbody>
    </table>
    </div> 
          </div>
</div>

        <p>
            <input type="submit" value="Aceptar" class = "redB" />

        </p>    
        
       <a href="javascript:history.back()">Regresar</a>
  }


